class Student < ActiveRecord::Base
  validates_numericality_of :fid, :allow_nil=>false, :if=> :allow_validation?
  validates_presence_of :name, :university, :grade, :college, :major, :sgroup, :gender, :studentId, :if=> :allow_validation?
  validates_numericality_of :height, :weight, :allow_nil=>true, :if=> :allow_validation?
  validates_uniqueness_of :studentId, :personalId, :allow_nil=>false, :if=> :allow_validation?
  validates_length_of :personalId, :in => 15..18, :if=> :allow_validation?

  def allow_validation?
    $allow_validation
  end
end
